﻿Imports System.Windows.Forms
Imports ArfaUI.Eufrat
Imports ArfaUI
'Imports SwdevIUIDatabase

Public Class Config

    Public Shared defaultHome As UserControl
    Public Shared phase As ApplicationPhase
    Public Shared Sub init()
        My.Settings.Reload()
        'store to session
        Session.dbname = My.Settings.dbname
        Session.dbhost = My.Settings.dbhost
        Session.dbuser = My.Settings.dbuser
        Session.dbpassword = My.Settings.dbpassword
        Session.dbport = My.Settings.dbport

        'define the status of this application
        phase = ApplicationPhase.Phase0_Development

        Pages.m_pageFactoryHash.Add(AssemblyName(), New ApplicationPageFactory)
        Pages.add("databaseSetting", AssemblyName() & ".DatabaseSettingsPage")
        Pages.add("home", AssemblyName() & ".HomePage")
        Pages.add("mainmenu", AssemblyName() & ".MainMenu")

        Pages.add("login", AssemblyName() & ".LoginPage")
        'Master Aplikasi
        Pages.add("FormMasterItem", AssemblyName() & ".MasterItemPage")
        Pages.add("FormMasterProduksi", AssemblyName() & ".MasterProduksiPage")
        Pages.add("FormMasterMenu", AssemblyName() & ".MasterMenuPage")
        Pages.add("FormMasterSupplier", AssemblyName() & ".MasterSupplierPage")
        Pages.add("FormMasterLocation", AssemblyName() & ".MasterLokasiItemPage")
        Pages.add("FormMasterBank", AssemblyName() & ".ListBankPage")
        Pages.add("FormMasterKartu", AssemblyName() & ".ListKartuPage")
        Pages.add("FormMasterMeja", AssemblyName() & ".MasterTabelPage")
        Pages.add("FormTabelPosition", AssemblyName() & ".SettingPosisiMejaPage")

        'Transaksi
        Pages.add("FormTrxOrderPembelian", AssemblyName() & ".TrxOrderPembelianPage")
        Pages.add("FormTrxPembelian", AssemblyName() & ".TrxPembelianPage")
        Pages.add("FormOrder", AssemblyName() & ".TrxOrderJualPage")
        Pages.add("FormStokAwal", AssemblyName() & ".TrxStokAwalPage")
        Pages.add("FormTrxPenggunaaStok", AssemblyName() & ".TrxPenggunaanStokPage")
        Pages.add("FormStokOpname", AssemblyName() & ".TrxStokOpnamePage")

        'Transaksi
        Pages.add("FormStokSaatIni", AssemblyName() & ".MonStokSaatIniPage")
        Pages.add("FormHistoriStok", AssemblyName() & ".MonHistoStokPage")

        'tools aplikasi
        Pages.add("FormSettingRole", AssemblyName() & ".SettingMenuPage")
        Pages.add("FormSettingPrinter", AssemblyName() & ".SettingPrinter")
        
        'Pages.add("FormUbahPassword", AssemblyName() & ".UbahPasswordPage")

        Pages.add("reportPage", AssemblyName() & ".ReportViewerPage")
        defaultHome = Pages.Item("home") 'homepage before login

        'MainWindow.initMenu()
        MainWindow.Text = Application.ProductName & " version " & Application.ProductVersion

    End Sub


    Public Shared Function AssemblyName() As String
        Return System.Reflection.Assembly.GetExecutingAssembly.GetName.Name()
    End Function

End Class
